package agentes;

  class Jeops_RuleBase_DiagramaSequenciaDicasRegras extends jeops.AbstractRuleBase {

	
    /**
     * Identifiers of rule diagramaVazio
     */
    private String[] identifiers_diagramaVazio = {
        "dicas",
        "respostas"
    };

    /**
     * Returns the identifiers declared in rule diagramaVazio
     *
     * @return the identifiers declared in rule diagramaVazio
     */
    private String[] getDeclaredIdentifiers_diagramaVazio() {
         return identifiers_diagramaVazio;
    }

    /**
     * Returns the name of the class of one declared object for
     * rule diagramaVazio.
     *
     * @param index the index of the declaration
     * @return the name of the class of the declared objects for
     *          this rule.
     */
    private String getDeclaredClassName_diagramaVazio(int index) {
        switch (index) {
            case 0: return "agentes.DiagramaSequenciaDicas";
            case 1: return "agentes.DiagramaSequenciaRespostas";
            default: return null;
        }
    }

    /**
     * Returns the class of one declared object for rule diagramaVazio.
     *
     * @param index the index of the declaration
     * @return the class of the declared objects for this rule.
     */
    private Class getDeclaredClass_diagramaVazio(int index) {
        switch (index) {
            case 0: return agentes.DiagramaSequenciaDicas.class;
            case 1: return agentes.DiagramaSequenciaRespostas.class;
            default: return null;
        }
    }

    /**
     * Sets an object declared in the rule diagramaVazio.
     *
     * @param index the index of the declared object
     * @param value the value of the object being set.
     */
    private void setObject_diagramaVazio(int index, Object value) {
        switch (index) {
            case 0: this.agentes_DiagramaSequenciaDicas_1 = (agentes.DiagramaSequenciaDicas) value; break;
            case 1: this.agentes_DiagramaSequenciaRespostas_1 = (agentes.DiagramaSequenciaRespostas) value; break;
        }
    }

    /**
     * Returns an object declared in the rule diagramaVazio.
     *
     * @param index the index of the declared object
     * @return the value of the corresponding object.
     */
    private Object getObject_diagramaVazio(int index) {
        switch (index) {
            case 0: return agentes_DiagramaSequenciaDicas_1;
            case 1: return agentes_DiagramaSequenciaRespostas_1;
            default: return null;
        }
    }

    /**
     * Returns all variables bound to the declarations 
     * of rule diagramaVazio
     *
     * @return an object array of the variables bound to the
     *          declarations of this rule.
     */
    private Object[] getObjects_diagramaVazio() {
        return new Object[] {
                            agentes_DiagramaSequenciaDicas_1,
                            agentes_DiagramaSequenciaRespostas_1
                            };
    }

    /**
     * Defines all variables bound to the declarations 
     * of rule diagramaVazio
     *
     * @param objects an object array of the variables bound to the
     *          declarations of this rule.
     */
    private void setObjects_diagramaVazio(Object[] objects) {
        agentes_DiagramaSequenciaDicas_1 = (agentes.DiagramaSequenciaDicas) objects[0];
        agentes_DiagramaSequenciaRespostas_1 = (agentes.DiagramaSequenciaRespostas) objects[1];
    }

    /**
     * Condition 0 of rule diagramaVazio.<p>
     * The original expression was:<br>
     * <code>respostas.respostasVazias()</code>
     *
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean diagramaVazio_cond_0() {
        return (agentes_DiagramaSequenciaRespostas_1.respostasVazias());
    }

    /**
     * Condition 1 of rule diagramaVazio.<p>
     * The original expression was:<br>
     * <code>!dicas.isExibiuDica1()</code>
     *
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean diagramaVazio_cond_1() {
        return (!agentes_DiagramaSequenciaDicas_1.isExibiuDica1());
    }

    /**
     * Checks whether some conditions of rule diagramaVazio is satisfied.
     *
     * @param index the index of the condition to be checked.
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean diagramaVazio_cond(int index) {
        switch (index) {
            case 0: return diagramaVazio_cond_0();
            case 1: return diagramaVazio_cond_1();
            default: return false;
        }
    }

    /**
     * Checks whether all conditions of rule diagramaVazio that depend only on
     * the given object are satisfied.
     *
     * @param declIndex the index of the declaration to be checked
     * @return <code>true</code> if all corresponding conditions for
     *          this rule are satisfied; <code>false</code> otherwise.
     */
    private boolean checkConditionsOnlyOf_diagramaVazio(int declIndex) {
        switch (declIndex) {
            case 0:
                if (!diagramaVazio_cond_1()) return false;
                return true;
            case 1:
                if (!diagramaVazio_cond_0()) return false;
                return true;
            default: return false;
        }
    }

    /**
     * Checks whether all the conditions of a rule which
     * reference some declared element of the declarations are
     * true.
     *
     * @param declIndex the index of the declared element.
     * @return <code>true</code> if the conditions that reference
     *          up to the given declaration are true;
     *          <code>false</code> otherwise.
     */
    private boolean checkCondForDeclaration_diagramaVazio(int declIndex) {
        switch (declIndex) {
            case 0:
                return true;
            case 1:
                return true;
            default: return false;
        }
    }

    /**
     * Executes the action part of the rule diagramaVazio
     */
    private void diagramaVazio() {
			agentes_DiagramaSequenciaDicas_1.mostrarAlerta(1);
			agentes_DiagramaSequenciaDicas_1.setExibiuDica1(true);
			modified(agentes_DiagramaSequenciaDicas_1);
			retract(agentes_DiagramaSequenciaDicas_1);
			retract(agentes_DiagramaSequenciaRespostas_1);
	
	    }


	
	
    /**
     * Identifiers of rule dicaExtra
     */
    private String[] identifiers_dicaExtra = {
        "dicas",
        "respostas"
    };

    /**
     * Returns the identifiers declared in rule dicaExtra
     *
     * @return the identifiers declared in rule dicaExtra
     */
    private String[] getDeclaredIdentifiers_dicaExtra() {
         return identifiers_dicaExtra;
    }

    /**
     * Returns the name of the class of one declared object for
     * rule dicaExtra.
     *
     * @param index the index of the declaration
     * @return the name of the class of the declared objects for
     *          this rule.
     */
    private String getDeclaredClassName_dicaExtra(int index) {
        switch (index) {
            case 0: return "agentes.DiagramaSequenciaDicas";
            case 1: return "agentes.DiagramaSequenciaRespostas";
            default: return null;
        }
    }

    /**
     * Returns the class of one declared object for rule dicaExtra.
     *
     * @param index the index of the declaration
     * @return the class of the declared objects for this rule.
     */
    private Class getDeclaredClass_dicaExtra(int index) {
        switch (index) {
            case 0: return agentes.DiagramaSequenciaDicas.class;
            case 1: return agentes.DiagramaSequenciaRespostas.class;
            default: return null;
        }
    }

    /**
     * Sets an object declared in the rule dicaExtra.
     *
     * @param index the index of the declared object
     * @param value the value of the object being set.
     */
    private void setObject_dicaExtra(int index, Object value) {
        switch (index) {
            case 0: this.agentes_DiagramaSequenciaDicas_1 = (agentes.DiagramaSequenciaDicas) value; break;
            case 1: this.agentes_DiagramaSequenciaRespostas_1 = (agentes.DiagramaSequenciaRespostas) value; break;
        }
    }

    /**
     * Returns an object declared in the rule dicaExtra.
     *
     * @param index the index of the declared object
     * @return the value of the corresponding object.
     */
    private Object getObject_dicaExtra(int index) {
        switch (index) {
            case 0: return agentes_DiagramaSequenciaDicas_1;
            case 1: return agentes_DiagramaSequenciaRespostas_1;
            default: return null;
        }
    }

    /**
     * Returns all variables bound to the declarations 
     * of rule dicaExtra
     *
     * @return an object array of the variables bound to the
     *          declarations of this rule.
     */
    private Object[] getObjects_dicaExtra() {
        return new Object[] {
                            agentes_DiagramaSequenciaDicas_1,
                            agentes_DiagramaSequenciaRespostas_1
                            };
    }

    /**
     * Defines all variables bound to the declarations 
     * of rule dicaExtra
     *
     * @param objects an object array of the variables bound to the
     *          declarations of this rule.
     */
    private void setObjects_dicaExtra(Object[] objects) {
        agentes_DiagramaSequenciaDicas_1 = (agentes.DiagramaSequenciaDicas) objects[0];
        agentes_DiagramaSequenciaRespostas_1 = (agentes.DiagramaSequenciaRespostas) objects[1];
    }

    /**
     * Condition 0 of rule dicaExtra.<p>
     * The original expression was:<br>
     * <code>!respostas.respostasVazias()</code>
     *
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean dicaExtra_cond_0() {
        return (!agentes_DiagramaSequenciaRespostas_1.respostasVazias());
    }

    /**
     * Checks whether some conditions of rule dicaExtra is satisfied.
     *
     * @param index the index of the condition to be checked.
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean dicaExtra_cond(int index) {
        switch (index) {
            case 0: return dicaExtra_cond_0();
            default: return false;
        }
    }

    /**
     * Checks whether all conditions of rule dicaExtra that depend only on
     * the given object are satisfied.
     *
     * @param declIndex the index of the declaration to be checked
     * @return <code>true</code> if all corresponding conditions for
     *          this rule are satisfied; <code>false</code> otherwise.
     */
    private boolean checkConditionsOnlyOf_dicaExtra(int declIndex) {
        switch (declIndex) {
            case 0:
                return true;
            case 1:
                if (!dicaExtra_cond_0()) return false;
                return true;
            default: return false;
        }
    }

    /**
     * Checks whether all the conditions of a rule which
     * reference some declared element of the declarations are
     * true.
     *
     * @param declIndex the index of the declared element.
     * @return <code>true</code> if the conditions that reference
     *          up to the given declaration are true;
     *          <code>false</code> otherwise.
     */
    private boolean checkCondForDeclaration_dicaExtra(int declIndex) {
        switch (declIndex) {
            case 0:
                return true;
            case 1:
                return true;
            default: return false;
        }
    }

    /**
     * Executes the action part of the rule dicaExtra
     */
    private void dicaExtra() {
			agentes_DiagramaSequenciaDicas_1.mostrarAlerta(2);
			agentes_DiagramaSequenciaDicas_1.setExibiuDica2(true);
			modified(agentes_DiagramaSequenciaDicas_1);
			retract(agentes_DiagramaSequenciaDicas_1);
			retract(agentes_DiagramaSequenciaRespostas_1);
	    }

		
		
	
    /**
     * Identifiers of rule respostaInvalida
     */
    private String[] identifiers_respostaInvalida = {
        "dicas"
    };

    /**
     * Returns the identifiers declared in rule respostaInvalida
     *
     * @return the identifiers declared in rule respostaInvalida
     */
    private String[] getDeclaredIdentifiers_respostaInvalida() {
         return identifiers_respostaInvalida;
    }

    /**
     * Returns the name of the class of one declared object for
     * rule respostaInvalida.
     *
     * @param index the index of the declaration
     * @return the name of the class of the declared objects for
     *          this rule.
     */
    private String getDeclaredClassName_respostaInvalida(int index) {
        switch (index) {
            case 0: return "agentes.DiagramaSequenciaDicas";
            default: return null;
        }
    }

    /**
     * Returns the class of one declared object for rule respostaInvalida.
     *
     * @param index the index of the declaration
     * @return the class of the declared objects for this rule.
     */
    private Class getDeclaredClass_respostaInvalida(int index) {
        switch (index) {
            case 0: return agentes.DiagramaSequenciaDicas.class;
            default: return null;
        }
    }

    /**
     * Sets an object declared in the rule respostaInvalida.
     *
     * @param index the index of the declared object
     * @param value the value of the object being set.
     */
    private void setObject_respostaInvalida(int index, Object value) {
        switch (index) {
            case 0: this.agentes_DiagramaSequenciaDicas_1 = (agentes.DiagramaSequenciaDicas) value; break;
        }
    }

    /**
     * Returns an object declared in the rule respostaInvalida.
     *
     * @param index the index of the declared object
     * @return the value of the corresponding object.
     */
    private Object getObject_respostaInvalida(int index) {
        switch (index) {
            case 0: return agentes_DiagramaSequenciaDicas_1;
            default: return null;
        }
    }

    /**
     * Returns all variables bound to the declarations 
     * of rule respostaInvalida
     *
     * @return an object array of the variables bound to the
     *          declarations of this rule.
     */
    private Object[] getObjects_respostaInvalida() {
        return new Object[] {
                            agentes_DiagramaSequenciaDicas_1
                            };
    }

    /**
     * Defines all variables bound to the declarations 
     * of rule respostaInvalida
     *
     * @param objects an object array of the variables bound to the
     *          declarations of this rule.
     */
    private void setObjects_respostaInvalida(Object[] objects) {
        agentes_DiagramaSequenciaDicas_1 = (agentes.DiagramaSequenciaDicas) objects[0];
    }

    /**
     * Condition 0 of rule respostaInvalida.<p>
     * The original expression was:<br>
     * <code>dicas.isHaErro()</code>
     *
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean respostaInvalida_cond_0() {
        return (agentes_DiagramaSequenciaDicas_1.isHaErro());
    }

    /**
     * Checks whether some conditions of rule respostaInvalida is satisfied.
     *
     * @param index the index of the condition to be checked.
     * @return <code>true</code> if the condition is satisfied;
     *          <code>false</code> otherwise.
     */
    private boolean respostaInvalida_cond(int index) {
        switch (index) {
            case 0: return respostaInvalida_cond_0();
            default: return false;
        }
    }

    /**
     * Checks whether all conditions of rule respostaInvalida that depend only on
     * the given object are satisfied.
     *
     * @param declIndex the index of the declaration to be checked
     * @return <code>true</code> if all corresponding conditions for
     *          this rule are satisfied; <code>false</code> otherwise.
     */
    private boolean checkConditionsOnlyOf_respostaInvalida(int declIndex) {
        switch (declIndex) {
            case 0:
                if (!respostaInvalida_cond_0()) return false;
                return true;
            default: return false;
        }
    }

    /**
     * Checks whether all the conditions of a rule which
     * reference some declared element of the declarations are
     * true.
     *
     * @param declIndex the index of the declared element.
     * @return <code>true</code> if the conditions that reference
     *          up to the given declaration are true;
     *          <code>false</code> otherwise.
     */
    private boolean checkCondForDeclaration_respostaInvalida(int declIndex) {
        switch (declIndex) {
            case 0:
                return true;
            default: return false;
        }
    }

    /**
     * Executes the action part of the rule respostaInvalida
     */
    private void respostaInvalida() {
			agentes_DiagramaSequenciaDicas_1.mostrarAlerta(3);
			retract(agentes_DiagramaSequenciaDicas_1);
	
	    }

	
	


    /**
     * The names of the rules in this class file
     */
    private static final String[] File_ruleNames = {
        "diagramaVazio",
        "dicaExtra",
        "respostaInvalida"
    };

    /**
     * Returns the name of the rules in this class file.
     *
     * @return the name of the rules in this class file.
     */
    public String[] getRuleNames() {
        return File_ruleNames;
    }

    /**
     * The number of declarations of the rules in this class file.
     */
    private static final int[] File_numberOfDeclarations = {
        2,
        2,
        1
    };

    /**
     * Returns the number of declarations of the rules in this class file.
     *
     * @return the number of declarations  of the rules in this class file.
     */
    public int[] getNumberOfDeclarations() {
        return File_numberOfDeclarations;
    }

    /**
     * The number of conditions of the rules in this class file.
     */
    private static final int[] File_numberOfConditions = {
        2,
        1,
        1
    };

    /**
     * Returns the number of conditions of the rules in this class file.
     *
     * @return the number of conditions  of the rules in this class file.
     */
    public int[] getNumberOfConditions() {
        return File_numberOfConditions;
    }

    /**
     * Checks whether a condition of some rule is satisfied.
     *
     * @param ruleIndex the index of the rule to be checked
     * @param condIndex the index of the condition to be checked
     * @return <code>true</code> if the corresponding condition for the
     *          given rule is satisfied. <code>false</code> otherwise.
     */
    public boolean checkCondition(int ruleIndex, int condIndex) {
        switch (ruleIndex) {
            case 0: return diagramaVazio_cond(condIndex);
            case 1: return dicaExtra_cond(condIndex);
            case 2: return respostaInvalida_cond(condIndex);
            default: return false;
        }
    }

    /**
     * Checks whether all conditions of some rule that depend only on
     * the given object are satisfied.
     *
     * @param ruleIndex the index of the rule to be checked
     * @param declIndex the index of the declaration to be checked
     * @return <code>true</code> if all corresponding conditions for
     *          the given rule are satisfied;
     *           <code>false</code> otherwise.
     */
    public boolean checkConditionsOnlyOf(int ruleIndex, int declIndex) {
        switch (ruleIndex) {
            case 0: return checkConditionsOnlyOf_diagramaVazio(declIndex);
            case 1: return checkConditionsOnlyOf_dicaExtra(declIndex);
            case 2: return checkConditionsOnlyOf_respostaInvalida(declIndex);
            default: return false;
        }
    }

    /**
     * Checks whether all the conditions of a rule which
     * reference only the elements declared up to the given index
     * are true.
     *
     * @param ruleIndex the index of the rule to be checked
     * @param declIndex the index of the declaration to be checked
     * @return <code>true</code> if all the conditions of a rule which
     *          reference only the elements declared up to the given index
     *          are satisfied; <code>false</code> otherwise.
     */
    public boolean checkCondForDeclaration(int ruleIndex, int declIndex) {
        switch (ruleIndex) {
            case 0: return checkCondForDeclaration_diagramaVazio(declIndex);
            case 1: return checkCondForDeclaration_dicaExtra(declIndex);
            case 2: return checkCondForDeclaration_respostaInvalida(declIndex);
            default: return false;
        }
    }

    /**
     * Returns the class name of an object declared in a rule.
     *
     * @param ruleIndex the index of the rule
     * @param declIndex the index of the declaration
     * @return the class name of the declared object.
     */
    public String getDeclaredClassName(int ruleIndex, int declIndex) {
        switch (ruleIndex) {
            case 0: return getDeclaredClassName_diagramaVazio(declIndex);
            case 1: return getDeclaredClassName_dicaExtra(declIndex);
            case 2: return getDeclaredClassName_respostaInvalida(declIndex);
            default: return null;
        }
    }

    /**
     * Returns the class of an object declared in a rule.
     *
     * @param ruleIndex the index of the rule
     * @param declIndex the index of the declaration
     * @return the class of the declared object.
     */
    public Class getDeclaredClass(int ruleIndex, int declIndex) {
        switch (ruleIndex) {
            case 0: return getDeclaredClass_diagramaVazio(declIndex);
            case 1: return getDeclaredClass_dicaExtra(declIndex);
            case 2: return getDeclaredClass_respostaInvalida(declIndex);
            default: return null;
        }
    }

    /**
     * Fires one of the rules in this rule base.
     *
     * @param ruleIndex the index of the rule to be fired
     */
    protected void internalFireRule(int ruleIndex) {
        switch (ruleIndex) {
            case 0: diagramaVazio(); break;
            case 1: dicaExtra(); break;
            case 2: respostaInvalida(); break;
        }
    }

    /**
     * Returns the number of rules.
     *
     * @return the number of rules.
     */
    public int getNumberOfRules() {
        return 3;
    }

    /**
     * Returns the identifiers declared in a given rule.
     *
     * @param ruleIndex the index of the rule.
     * @return an array with the identifiers of the rule declarations.
     */
    public String[] getDeclaredIdentifiers(int ruleIndex) {
        switch (ruleIndex) {
            case 0: return getDeclaredIdentifiers_diagramaVazio();
            case 1: return getDeclaredIdentifiers_dicaExtra();
            case 2: return getDeclaredIdentifiers_respostaInvalida();
            default: return new String[0];
        }
    }

    /**
     * Sets an object that represents a declaration of some rule.
     *
     * @param ruleIndex the index of the rule
     * @param declIndex the index of the declaration in the rule.
     * @param value the value of the object being set.
     */
    public void setObject(int ruleIndex, int declIndex, Object value) {
        switch (ruleIndex) {
            case 0: setObject_diagramaVazio(declIndex, value); break;
            case 1: setObject_dicaExtra(declIndex, value); break;
            case 2: setObject_respostaInvalida(declIndex, value); break;
        }
    }

    /**
     * Returns an object that represents a declaration of some rule.
     *
     * @param ruleIndex the index of the rule
     * @param declIndex the index of the declaration in the rule.
     * @return the value of the corresponding object.
     */
    public Object getObject(int ruleIndex, int declIndex) {
        switch (ruleIndex) {
            case 0: return getObject_diagramaVazio(declIndex);
            case 1: return getObject_dicaExtra(declIndex);
            case 2: return getObject_respostaInvalida(declIndex);
            default: return null;
        }
    }

    /**
     * Returns all variables bound to the declarations of
     * some rule.
     *
     * @param ruleIndex the index of the rule
     * @return an object array of the variables bound to the
     *          declarations of some rule.
     */
    public Object[] getObjects(int ruleIndex) {
        switch (ruleIndex) {
            case 0: return getObjects_diagramaVazio();
            case 1: return getObjects_dicaExtra();
            case 2: return getObjects_respostaInvalida();
            default: return null;
        }
    }
    /**
     * Defines all variables bound to the declarations of
     * some rule.
     *
     * @param ruleIndex the index of the rule
     * @param objects an object array of the variables bound to the
     *          declarations of some rule.
     */
    public void setObjects(int ruleIndex, Object[] objects) {
        switch (ruleIndex) {
            case 0: setObjects_diagramaVazio(objects); break;
            case 1: setObjects_dicaExtra(objects); break;
            case 2: setObjects_respostaInvalida(objects); break;
        }
    }

    /*
     * The variables declared in the rules.
     */
    private agentes.DiagramaSequenciaDicas agentes_DiagramaSequenciaDicas_1;
    private agentes.DiagramaSequenciaRespostas agentes_DiagramaSequenciaRespostas_1;

    /**
     * Class constructor.
     *
     * @param knowledgeBase the knowledge base that contains this rule base.
     */
    public Jeops_RuleBase_DiagramaSequenciaDicasRegras(jeops.AbstractKnowledgeBase knowledgeBase) {
        super(knowledgeBase);
    }

}
/**
 * Knowledge base created by JEOPS from file DiagramaSequenciaDicasRegras.rules
 *
 * @version Dec 11, 2013
 */
public class DiagramaSequenciaDicasRegras extends jeops.AbstractKnowledgeBase {

    /**
     * Creates a new knowledge base with the specified conflict set with the
     * desired conflict resolution policy.
     *
     * @param conflictSet a conflict set with the desired resolution policy
     */
    public DiagramaSequenciaDicasRegras(jeops.conflict.ConflictSet conflictSet) {
        super(conflictSet);
    }

    /**
     * Creates a new knowledge base, using the default conflict resolution
     * policy.
     */
    public DiagramaSequenciaDicasRegras() {
        this(new jeops.conflict.DefaultConflictSet());
    }

    /**
     * Factory method used to instantiate the rule base.
     */
    protected jeops.AbstractRuleBase createRuleBase() {
        return new Jeops_RuleBase_DiagramaSequenciaDicasRegras(this);
    }

}
